package org.jackysoft.interceptor;

import java.lang.reflect.Method;

import com.opensymphony.xwork2.ActionInvocation;

public class BatchCreateInterceptor extends AbstractInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3352333942100843488L;
	@Override
	public String intercept(ActionInvocation invokor) throws Exception {
		String rst = super.intercept(invokor);
		if(VALIDATED.equals(rst)){
			return VALIDATED;
		}
		// 获得这个action中所对应的class类型参数
		
		Method createBean = service.getClass().getMethod("create",java.util.Collection.class);
		// 调用service的插入bean方法
		
		createBean.invoke(service, beans);		
		
		return invokor.invoke();
	}

}
